# 找出整形数组中，任意三个数的乘机的最大值
list = [1, 2, 3, 4, 5, -5, -5, -4, -3, -7]
le = len(list)
max_res = list[0] * list[1] * list[2]
for i in range(0, le):
    for j in range(i + 1, le):
        for k in range(j + 1, le):
            # print(list[i], list[j], list[k])
            res = list[i] * list[j] * list[k]
            if res > max_res:
                max_res = res
            # print("max_res", max_res)
            # print("========================================")
print(max_res)

# 删除s1中出现的s2字符串，并返回删除s2后的字符串s1
def delete_child_str(s1,s2):
    while s2 in s1:
        left_end = s1.index(s2)
        l = len(s2)
        right_begin = left_end + l
        s1 = s1[0:left_end] + s1[right_begin:]
    return s1

# 用递归方法统计整形数列中出现3的次数
def getTimes():
    list_source = [1,3,13,23,4]
    list_source = [str(x) for x in list_source]
    print(list_source)
    cou =0
    inThree(list_source,coun=cou)
    print(cou)

def inThree(li,coun):
    for x in li:
        if "3" in x:
            coun += 1
            li.remove(x)
            inThree(li,coun)
            print("count:",coun)
        else:
            continue


import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams

# 设置中文字体，确保能够显示中文
rcParams['font.sans-serif'] = ['SimHei']  # 或者 'Microsoft YaHei'，根据你的系统环境选择字体
rcParams['axes.unicode_minus'] = False   # 解决负号显示问题


def generate_histogram(response_times, bin_count=10):
    # 创建柱状图
    plt.figure(figsize=(10, 6))  # 图形大小
    plt.hist(response_times, bins=bin_count, color='blue', edgecolor='black', alpha=0.7)

    # 添加标题和标签
    plt.title('接口响应时间分布', fontsize=16)
    plt.xlabel('响应时间 (ms)', fontsize=12)
    plt.ylabel('频率', fontsize=12)

    # 显示网格
    plt.grid(True, linestyle='--', alpha=0.6)

    # 展示图表
    plt.show()


# 示例

if __name__ == '__main__':
    # print("sdsdfasf".index("fa"))
    # print(delete_child_str("sdsdfasf","sd"))
    # ls_1 = [1,2,3]
    # print([str(x) for x in ls_1])
    print(getTimes())

    response_times = [120, 130, 110, 125, 140, 180, 100, 90, 200, 300, 150, 170, 160, 200, 110]
    generate_histogram(response_times)



